package com.xiyue.leaspring.test;

import java.util.Date;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.xiyue.leaspring.vo.Member;

@ContextConfiguration(locations = {"classpath:spring/spring-redis2.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
public class MemberTest2 {
	
	@Autowired
	private RedisTemplate<String,Object> redisTemplate;

	@Test
	public void testLoad() {
		Object obj = this.redisTemplate.opsForValue().get("mldn-1");
		System.out.println(obj);
	}
	
	@Test
	public void testSave() {
		Member member = new Member();
		member.setMid("mldn-java");
		member.setBrithday(new Date());
		member.setName("张三");
		member.setAge(18);
		member.setSalary(9897.2);
		this.redisTemplate.opsForValue().set("mldn-1", member);
	}

}
